<?php
	function sz_fBase64Encode($sz_Data)
	{
		return base64_encode($sz_Data.TICKET_KEY);
	}
		
	function sz_fBase64Decode($sz_Data)
	{
		return base64_decode($sz_Data, TICKET_KEY);
	}
	
	function resizeImage($CurWidth,$CurHeight,$MaxWidth,$MaxHeight,$DestFolder,$SrcImage)
	{
		$ImageScale      	= min($MaxWidth/$CurWidth, $MaxHeight/$CurHeight);
		$NewWidth  			= ceil($ImageScale*$CurWidth);
		$NewHeight 			= ceil($ImageScale*$CurHeight);
		$NewCanves 			= imagecreatetruecolor($NewWidth, $NewHeight);
		// Resize Image
		if(imagecopyresampled($NewCanves, $SrcImage,0, 0, 0, 0, $NewWidth, $NewHeight, $CurWidth, $CurHeight))
		{
			// copy file
			if(imagejpeg($NewCanves,$DestFolder,100))
			{
				imagedestroy($NewCanves);
				return true;
			}
		}
	}
?>